<template>
	<view class="page">
		<!-- <uni-nav-bar backgroundimage="true" title="我的" :navtxtclass="0" :border="false"></uni-nav-bar> -->

		<view class="center">
			<view class="logo" @click="bindLogin" :hover-class="!hasLogin ? 'logo-hover' : ''">
				<image class="logo-img" :src="avatar"></image>
				<view class="logo-title">
					<view class="uni-list-item__content txt">
						<text class="uer-name">{{hasLogin ? nickname : '您未登录,请先登录'}}</text>
						<text class="re-uni-list-item__content-note">{{userInfo.deptName}}</text>
					</view>
				</view>
			</view>

			<view class="center-list">
				<view class="center-list-item border-bottom" v-show="hasLogin" @click="goto('set')">
					<image class="slot-image2" src="/static/img/ico_zhgl_@3x.png" mode="widthFix"></image>
					<text class="list-text">账号管理</text>
					<text class="navigat-arrow">&#xe65e;</text>
				</view>

				<view class="center-list-item border-bottom" @click="goto('contactUs')">
					<image class="slot-image2" src="/static/img/ico_lxwm_@3x.png" mode="widthFix"></image>
					<text class="list-text">联系我们</text>
					<text class="navigat-arrow">&#xe65e;</text>
				</view>

				<view class="center-list-item border-bottom" @click="goto('opinion')">
					<image class="slot-image2" src="/static/img/ico_opinion@3x.png" mode="widthFix"></image>
					<text class="list-text">意见反馈</text>
					<text class="navigat-arrow">&#xe65e;</text>
				</view>
				<!-- #ifdef APP-PLUS||H5 -->
			<!-- 	<view class="center-list-item" @click="goto('update_log')">
					<image class="slot-image2" src="/static/img/ico_update_log@3x.png" mode="widthFix"></image>
					<text class="list-text">版本记录</text>
					<text class="navigat-arrow">&#xe65e;</text>
				</view> -->
				<!-- #endif -->
			</view>
			<!-- 清缓存 -->
			<!-- <uni-popup id="popupDialogclear" ref="popupDialogclear" type="dialog">
				<uni-popup-dialog type="warn" title="清理缓存" content="是否清除缓存" :before-close="true"
					@confirm="dialogConfirmclear" @close="dialogClose"></uni-popup-dialog>
			</uni-popup> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo:{},
				ref: false,
				post: '',
				nickname: uni.getStorageSync('nickname'),
				avatar: uni.getStorageSync('avatar') ? uni.getStorageSync('avatar').replace('http://localhost:18000/manage',getApp().globalData.baseUrl) : '../../static/txl/ico_logo_@3x.png',
				inviteUrl: '',
				logoutBtnLoading: false,
				hasPwd: uni.getStorageSync('uni_id_has_pwd')
			}
		},
		computed: {
		},
		onLoad() {
		},
		onShow() {
			console.log('user onShow')
			this.userInfo = uni.getStorageSync('userInfo')
			console.log(this.userInfo)
			this.avatar = uni.getStorageSync('avatar') ? uni.getStorageSync('avatar').replace('http://localhost:18000/manage',getApp().globalData.baseUrl) : '../../static/txl/ico_logo_@3x.png'
			this.nickname = this.userInfo.userName
		},
		methods: {
			hasLogin() {

			},
			clear(type) {
				this.$refs.popupDialogclear.open()
			},
			dialogConfirmclear(done) {
				//清理缓存，只清理特定数据
				uni.removeStorageSync('uni_deviceId')
				uni.removeStorageSync('launchFlag')
				uni.removeStorageSync('uni-needCaptcha')
				uni.removeStorageSync('login_type')
				uni.removeStorageSync('uni_id_has_pwd')
				done();
				uni.showToast({
					title: "清除成功"
				})
			},
			/**
			 * 对话框取消按钮
			 */
			dialogClose(done) {
				this.msgType = 'info'
				done()
			},
			bindLogin() {

			},
			bindLogout() {},
			loadData(clear = true) {

			},
			goto(value) {
				switch (value) {
					case 'set':
						uni.navigateTo({
							url:'/pages/user/setting/setting?id=' + this.uid + '&avatar=' + this.avatar,
							events: {}
						})
						break;
					case 'contactUs':
						uni.navigateTo({
							url: '/pages/user/contactUs/contactUs',
							events: {}
						})
						break;
					case 'opinion':
						uni.navigateTo({
							url: '/pages/user/feedback/feedback',
							events: {}
						})
						break;
					case 'update_log':
						console.log(value)
						let p = encodeURIComponent('https://ext.dcloud.net.cn/plugin?id=15605&update_log')
						uni.navigateTo({
							url: `/pages/my-webview/my-webview?path=${p}`,
							fail(err) {
								console.log(err)
							}
						})
						break;
					default:
						break;
				}

			},
			update() {

			}

		}
	}
</script>

<style>
	@font-face {
		font-family: texticons;
		font-weight: normal;
		font-style: normal;
		src: url('https://at.alicdn.com/t/font_984210_5cs13ndgqsn.ttf') format('truetype');
	}

	button {
		width: 100%;
	}

	.center {
		flex-direction: column;
	}

	.logo {
		width: 750rpx;
		height: 252rpx;
		padding: 0 32rpx 0 36rpx;
		box-sizing: border-box;
		flex-direction: row;
		align-items: center;
		display: flex;
		background-image: url(https://vkceyugu.cdn.bspapp.com/VKCEYUGU-0f215899-37db-41b7-8231-51232da1a1a3/750d3eb5-53cc-4eab-9fd4-07debb5bfb72.png);
		background-size: 100% auto;
		background-repeat: no-repeat;
		background-position-y: -75px;
		background-color: #ffffff;
		margin-bottom: 10px;
	}

	.logo-hover {
		opacity: 0.8;
	}

	.logo-img {
		width: 120rpx;
		height: 120rpx;
		display: inline-block;
	}

	.logo-title {
		/* height: 150rpx;
		flex: 1;
		align-items: center;
		justify-content: space-between;
		flex-direction: row; */
		margin-left: 32rpx;
		display: inline-block;
		/* position:relative;
		z-index:99999; */
	}

	.uer-name {
		color: #333333;
		font-family: PingFang SC;
		font-weight: bold;
		font-size: 18px;
		line-height: normal;
		letter-spacing: 0px;
		text-align: left;
	}

	.go-login.navigat-arrow {
		color: #FFFFFF;
	}

	.login-title {
		height: 150rpx;
		align-items: self-start;
		justify-content: center;
		flex-direction: column;
		margin-left: 20rpx;
	}

	.center-list {
		background-color: #FFFFFF;
		width: 750rpx;
		flex-direction: column;
	}

	.center-list-item {
		/* width: 750rpx; */
		box-sizing: border-box;
		flex-direction: row;
		margin: 0 42rpx 0 38rpx;
		padding: 20rpx 0;
		display: flex;
	}

	.border-bottom {
		border-bottom-width: 1rpx;
		border-color: #c8c7cc;
		border-bottom-style: solid;
	}

	.list-icon {
		width: 48rpx;
		height: 48rpx;
		line-height: 90rpx;
		color: #0faeff;
		text-align: center;
		font-family: texticons;
		margin-right: 20rpx;
	}

	.list-text {
		height: 90rpx;
		line-height: 90rpx;
		color: #555;
		flex: 1;
		text-align: left;
	}

	.navigat-arrow {
		height: 90rpx;
		width: 40rpx;
		line-height: 90rpx;
		color: #555;
		text-align: right;
		font-family: texticons;
	}

	.re-uni-list-item__content-note {
		color: #999999;
		font-family: PingFang SC;
		font-weight: medium;
		font-size: 13px;
		line-height: normal;
		letter-spacing: 0px;
		text-align: left;
	}

	.rlist-text {
		height: 90rpx;
		line-height: 90rpx;
		flex: 1;
		color: #999999;
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 13px;
		letter-spacing: 0px;
		text-align: right;
	}

	.slot-image2 {
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
		margin-right: 16px;
		margin-left: 6px;
		margin-top: 12px;
		width: 48rpx;
		height: 48rpx;
	}
</style>